Only sync the display if creating a native window implicitly
authorAlexander Larsson <alexl@redhat.com>
Thu, 29 Jan 2009 18:52:12 +0000 (19:52 +0100)
committerAlexander Larsson <alex@localhost.localdomain>
Thu, 2 Apr 2009 08:15:29 +0000 (10:15 +0200)
gdk/gdkwindow.c
gdk/x11/gdkdrawable-x11.c

index b4428651efa7e39ae662d449e0371df01912a9fe..102fc903e76e119e8a5301c2b40bdbf46fba289e 100644 (file)
@@ -1305,12 +1305,6 @@ gdk_window_set_has_native (GdkWindow *window, gboolean has_native)
 
       if (gdk_window_is_viewable (window))
        GDK_WINDOW_IMPL_GET_IFACE (private->impl)->show (window);
-
-      /* We sync here to ensure the window is created in the Xserver when
-       * this function returns. This is required because the returned XID
-       * for this window must be valid immediately, even with another
-       * connection to the Xserver */
-      gdk_display_sync (gdk_drawable_get_display (window));
     }
   else
     {
index 5c4abceca392bca1ef69797bb62cd4a157a2dc36..2e53041bb2c87df62d4da037bc92d07e193b3db0 100644 (file)
@@ -875,14 +875,22 @@ gdk_x11_drawable_get_xid (GdkDrawable *drawable)
       
       /* Try to ensure the window has a native window */
       if (!_gdk_window_has_impl (window))
-       gdk_window_set_has_native (window, TRUE);
+       {
+         gdk_window_set_has_native (window, TRUE);
+
+         /* We sync here to ensure the window is created in the Xserver when
+          * this function returns. This is required because the returned XID
+          * for this window must be valid immediately, even with another
+          * connection to the Xserver */
+         gdk_display_sync (gdk_drawable_get_display (window));
+       }
       
       if (!GDK_WINDOW_IS_X11 (window))
         {
           g_warning (G_STRLOC " drawable is not a native X11 window");
           return None;
         }
-
+      
       impl = ((GdkWindowObject *)drawable)->impl;
     }
   else if (GDK_IS_PIXMAP (drawable))